Skip to content

Update library for Zig 0.16.0#46

Open
snorm-dev wants to merge 4 commits into
bronter:mainfrom
snorm-dev:patch/zig-0.16
Open

Update library for Zig 0.16.0#46
snorm-dev wants to merge 4 commits into
bronter:mainfrom
snorm-dev:patch/zig-0.16

Conversation

@snorm-dev
Copy link
Copy Markdown

Changes

  • updates in build.zig, mostly using functions on Compile.root_module
  • callconv(.C) -> callconv(.c)
  • Thread.sleep -> std.Io.sleep; requires passing in a std.Io
  • bump minimum_zig_version

@apotema
Copy link
Copy Markdown

apotema commented May 26, 2026

Can this be merged

@apotema
Copy link
Copy Markdown

apotema commented May 26, 2026

@bronter

apotema added a commit to labelle-toolkit/labelle-assembler that referenced this pull request May 26, 2026
Upstream bronter/wgpu_native_zig hasn't migrated to Zig 0.16
(last commit 2025-07, before 0.16 existed). snorm-dev/wgpu_native_zig
PR #46 to bronter is open + clean + mergeable (opened 2026-05-23) but
not yet reviewed by the maintainer.

Pin directly to snorm-dev's branch SHA so our PR #228 can land. Repin
to bronter/main once #46 merges.

Was: apotema/wgpu_native_zig@fb54d9c8 (also pre-0.16)
Now: snorm-dev/wgpu_native_zig@8aef4a98 (Zig 0.16 migration)

Reference: bronter/wgpu_native_zig#46
apotema added a commit to labelle-toolkit/labelle-assembler that referenced this pull request May 26, 2026
* chore(wgpu): build cleanly on Zig 0.16.0 (closes #220)

Mirrors PR #218's sokol sweep for the wgpu backend:

- `src/audio.zig:loadWav` + `src/gfx.zig:loadTexture` — swap
  `std.fs.cwd().openFile` for libc `fopen` / `fread` / `fclose` in the
  legacy path-based one-shot loaders. Zig 0.16 retired `std.fs.cwd()`
  in favour of `std.Io.Dir.cwd()` (requires an `Io` parameter threaded
  through). Production code goes through caller-provided byte buffers
  (`decodeImage`, `wav_parser.parseWav`) and never touches the FS, so
  threading `Io` through the whole backend for two legacy loaders is
  overkill.
- `build.zig` — add `link_libc = true` on the `gfx` and `audio`
  modules so the libc swap links. These modules previously didn't
  link libc (no native deps), so this is a new opt-in. Switch
  `b.dependency("wgpu_native_zig", ...)` to `b.lazyDependency` since
  Zig 0.16 panics on `b.dependency` for a `lazy = true` dep.
- `src/wav_parser.zig:202` — `std.ArrayList(u8) = .{}` -> `.empty`.
  Zig 0.16 drops the default-fields shape for the unmanaged
  ArrayList, requiring the named sentinel. This blocked
  `zig build test`.
- `example/build.zig` — move `linkLibrary` / `linkSystemLibrary` /
  `addLibraryPath` from `*Build.Step.Compile` onto `exe.root_module`
  (0.16 moved those helpers onto `*Build.Module`). `linkSystemLibrary`
  on `*Module` now takes an extra options struct; passing `.{}`.
- `build.zig.zon` (both) — `minimum_zig_version` 0.15.2 -> 0.16.0.

Environmental blocker (called out in build.zig + PR body): upstream
`apotema/wgpu_native_zig` @ fb54d9c8 is not yet Zig 0.16 compatible —
its own build.zig calls `linkFramework` / `addLibraryPath` /
`addObjectFile` on `*Compile`, which 0.16 moved onto `*Module`. Zig
0.16's build runner pre-compiles every transitive build.zig, so any
`zig build` subcommand hits those upstream errors before our build
function runs. Fixing that fork is a sibling-repo concern; this patch
keeps the assembler-side surface 0.16-ready so the migration lands as
soon as the fork catches up.

Verification:

- `zig ast-check` clean on all modified files.
- `zig test src/wav_parser.zig` — 14/14 pass (regression lock for
  #12 still green).
- `zig build-obj src/audio.zig -lc` — compiles clean (validates the
  libc swap in isolation).
- `zig build` / `zig build test` blocked by the upstream
  `wgpu_native_zig` 0.16 incompatibility described above (not
  introduced here — present on origin/main too).
- Example `zig build` not reached (same upstream block, plus Dawn
  prebuilt unavailable on this host).

Scope: only `backends/wgpu/`. Does not touch sibling backends (each
has its own ticket).

* chore(wgpu): pin wgpu_native_zig to snorm-dev's Zig 0.16 PR branch

Upstream bronter/wgpu_native_zig hasn't migrated to Zig 0.16
(last commit 2025-07, before 0.16 existed). snorm-dev/wgpu_native_zig
PR #46 to bronter is open + clean + mergeable (opened 2026-05-23) but
not yet reviewed by the maintainer.

Pin directly to snorm-dev's branch SHA so our PR #228 can land. Repin
to bronter/main once #46 merges.

Was: apotema/wgpu_native_zig@fb54d9c8 (also pre-0.16)
Now: snorm-dev/wgpu_native_zig@8aef4a98 (Zig 0.16 migration)

Reference: bronter/wgpu_native_zig#46
apotema added a commit to labelle-toolkit/labelle-assembler that referenced this pull request May 26, 2026
7 PRs since v0.34.1:
- #225 fix(raylib): takeScreenshot handles absolute paths (closes #224)
- #230 fix(raylib): replace rename trick with direct libc write
       (closes #229 — Linux EXDEV + Windows compile + Ubuntu X11)
- #231 fix(sdl): SDL_DISABLE_ARM_NEON_H for Zig 0.16 arm_neon.h mismatch
- #226 chore(backends): Zig 0.16 sweep on sdl + raylib + null (closes #221)
- #227 chore(bgfx): build cleanly on Zig 0.16.0 + zbgfx pin bump
       (closes #219)
- #228 chore(wgpu): build cleanly on Zig 0.16.0 + snorm-dev pin
       (closes #220, refs bronter/wgpu_native_zig#46)
- #216 fix(codegen): sanitize plugin idents in resolve() emit (closes #212)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants